﻿using Assets.Script.HelpSystem.AtkSystem.Base;
using Assets.Script.HelpSystem.AtkSystem.Config;
using Assets.Script.Tools;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Assets.Script.Human.Player.Config
{
    public class RolePool
    {
        public Dictionary<string, RoleData> HeroDataDic = new Dictionary<string, RoleData>();

        public void Create()
        {
            HeroDataDic.Add("BallBoy", BallBoyConfig());
            HeroDataDic.Add("KnifeGirl", KnifeGirlConfig());
        }

        /// <summary>
        /// 获取一份从存档中复制出的HeroData(不含等级信息)
        /// </summary>
        /// <param name="heroName"></param>
        /// <returns></returns>
        public RoleData GetHeroData_Copy(string heroName)
        {
            var h = HeroDataDic[heroName];

            var c = new RoleData();
            c.atkInfos = h.atkInfos;

            c.name = h.name;
            c.playerData = new Data.Player.PlayerData(h.playerData);

            return c;
        }

        private RoleData BallBoyConfig()
        {
            RoleData boy = new RoleData();

            boy.atkInfos = new AtkInfo[] { AtkInfoDic.GetInfo("ShootNormal"), AtkInfoDic.GetInfo("GunS"), AtkInfoDic.GetInfo("Healing") };

            boy.name = "BallBoy";

            boy.playerData = new Data.Player.PlayerData();
            boy.playerData.AttackDir = new AttackDir() { forward = 1, back = 0, left = 0, rigt = 0 };
            boy.playerData.ShiedRecTime = new BaseData(3);
            boy.playerData.MaxHp = new BaseData(100);
            boy.playerData.MaxMana = new BaseData(50);
            boy.playerData.RunSpeed = new BaseData(4);
            boy.playerData.AtkSpeed = new BaseData(2);
            boy.playerData.InjuredInterval = new BaseData(0.5f);

            boy.playerData.BulletData = new BulletData()
            {
                Atk = new BaseData(3),
                BulletScale = new BaseData(1),
                BulletLifeTime = new BaseData(3),
                BulletSpeed = new BaseData(10)
            };

            return boy;

        }

        private RoleData KnifeGirlConfig()
        {
            RoleData boy = new RoleData();

            boy.atkInfos = new AtkInfo[] { AtkInfoDic.GetInfo("KnifeN"), AtkInfoDic.GetInfo("KnifeS"), AtkInfoDic.GetInfo("Healing") };

            boy.name = "KnifeGirl";


            boy.playerData = new Data.Player.PlayerData();
            boy.playerData.AttackDir = new AttackDir() { forward = 1, back = 0, left = 0, rigt = 0 };
            boy.playerData.ShiedRecTime = new BaseData(3);
            boy.playerData.MaxHp = new BaseData(100);
            boy.playerData.MaxMana = new BaseData(50);
            boy.playerData.RunSpeed = new BaseData(4);
            boy.playerData.AtkSpeed = new BaseData(2);
            boy.playerData.InjuredInterval = new BaseData(0.5f);

            boy.playerData.BulletData = new BulletData()
            {
                Atk = new BaseData(3),
                BulletScale = new BaseData(1),
                BulletLifeTime = new BaseData(3),
                BulletSpeed = new BaseData(10)
            };

            return boy;

        }
    }
}
